package com.dys.controller;

import com.dys.pojo.Pet;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @className: com.dys.controller.ResponseJsonController
 * @description: SpringMVC_响应JSON
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/10/26 23:11
 */
@Controller
public class ResponseJsonController {

    @ResponseBody
    @RequestMapping(value = "/testJson", method = RequestMethod.GET)
    public Pet testJson() {
        Pet pet = new Pet("Tom", "Cat");
        return pet;
    }

    @ResponseBody
    @RequestMapping(value = "/testPetJson", method = RequestMethod.GET)
    public Pet testPetJson(Pet p) {
        System.out.println(p);
        Pet pet = new Pet("Tom", "Cat");
        return pet;
    }
}
